package cn.edu.zut.hhr.utils;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;
import java.io.IOException;

public class ResponseUtil {

    public static void out(HttpServletResponse response, RestResponse restResponse){
        ObjectMapper objectMapper = new ObjectMapper();
        response.setContentType(MediaType.APPLICATION_JSON);
        try {
            objectMapper.writeValue(response.getWriter(),restResponse);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
